<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class CourseXZ extends Model
{
    public $timestamps = false;
    protected $connection = 'xz';
    protected $table = 'course';
    use HasFactory;

    public function videos()
    {
        return $this->hasMany('App\Models\CourseVideo','course_uniqid','uniqid')->select('id','title','duration','course_uniqid','sort','file_url','play_url','file_id');
    }

    public function types()
    {
        return $this->hasOne('App\Models\ProColumn','id','top_category')->select('id','title');
    }

    public function two_types()
    {
        return $this->hasOne('App\Models\ProColumn','id','secondary_category')->select('id','title');
    }

    public function class()
    {
        return $this->belongsToMany('App\Models\ProColumn','course_class','class_id','course_id');
    }
}
